package top.v5it.japi.ddd.example.order.event;

import org.springframework.context.ApplicationListener;

/**
 * 监听订单相关事件，当收到相关事件执行相关任务
 *
 * @author zhanpu
 * @date 2023/11/17
 */
public class OrderEventListener implements ApplicationListener<OrderEvent> {

    @Override
    public void onApplicationEvent(OrderEvent event) {
        if (OrderEvent.EventType.create.equals(event.getEventType())) {
            event.sendCreateOrderMessage();
            return;
        }
        event.sendPaymentOrderMessage();
    }
}
